{% extends 'layout.html' %}

{% block content %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{{ title }}</h3>
        </div>
        <div class="panel-body">
            <form class="form-horizontal" action="" novalidate method="post">
            {% csrf_token %}
               {% for field in form_obj %}

                    <div class="form-group {% if field.errors %}has-error{% endif %}">
                    <label for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{ field.label }}</label>
                    <div class="col-sm-8">
                        {{ field }}
                        <span class="help-block"> {{ field.errors.0 }}</span>
                    </div>
                </div>
               {% endfor %}
                <div class="text-center text-danger">
                    {{ form_obj.non_field_errors.0 }} <!--展示__all__的错误-->
                </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-default">提交</button>
            </div>
        </div>
    </form>
        </div>
    </div>

{% endblock %}